//: Playground - noun: a place where people can play

import UIKit

let yMdFormatter: DateFormatter = {
    var yMdFormatter = DateFormatter()
    yMdFormatter.dateFormat = "yyyy-MM-dd HH:mm"
    return yMdFormatter
}()

let yMdHmFormatter: DateFormatter = {
    var yMdFormatter = DateFormatter()
    yMdFormatter.dateFormat = "yyyy-MM-dd HH:mm"
    return yMdFormatter
}()


let lastCloseTimeStamp: TimeInterval = 1528732650.869395
var lastCloseDate = Date(timeIntervalSince1970: lastCloseTimeStamp)
var curDate = Date()
var zeroDate = Date(timeIntervalSince1970: 0)

var components = Calendar.current.dateComponents([.year, .month, .day, .hour, .minute, .second], from: zeroDate, to: curDate)
var components2 = Calendar.current.dateComponents([.year, .month, .day, .hour, .minute, .second], from: zeroDate, to: lastCloseDate)

 yMdHmFormatter.string(from: lastCloseDate)

let testData = yMdHmFormatter.date(from: "2018-06-11 00:00")
yMdFormatter.date(from: "")

print("component = \(components)")


